package com.probiz.estore.system.service.impl;

import java.util.List;

import com.probiz.estore.common.model.system.CompanyInfo;
import com.probiz.estore.core.service.impl.GenericManagerImpl;
import com.probiz.estore.system.dao.CompanyInfoDao;


/**
 * CompanyInfo Business Delegate (Proxy) implementation to handle communication between web and
 * persistence layer. Implementation of CompanyInfoManager interface.
 * Developer introduced interfaces should be declared here. Won't get overwritten.
 */
public class CompanyInfoManagerImpl extends GenericManagerImpl<CompanyInfo> implements com.probiz.estore.system.service.CompanyInfoManager {

	private CompanyInfoDao companyInfoDao = null;
	
	public void setCompanyInfoDao(CompanyInfoDao companyInfoDao) {
		this.companyInfoDao = companyInfoDao;
	}

	public CompanyInfo getDefaultCompany() {
		List results = this.listAll();
		CompanyInfo info = new CompanyInfo();
		if(results.size()>0) info = (CompanyInfo)results.get(0);
		return info;
	}

	
	public void saveCompanyInfo(CompanyInfo c) {
		companyInfoDao.save(c);
	}

	@Override
	protected void initManager() {
		dao = companyInfoDao;
	}

	@Override
	protected void preDelete(CompanyInfo entity) {
		
	}

	@Override
	protected void preSave(CompanyInfo entity) {
		
	}

}
